#!/bin/bash
es_home=/opt/module/elasticsearch
case $1 in
"start") {
  for i in hadoop202 hadoop203 hadoop204 do
    echo "==============$i 上 ES 启动=============="
    ssh $i "source /etc/profile;${es_home}/bin/elasticsearch >/dev/null 2>&1 &"
  done
} ;;
"stop") {
  for i in hadoop202 hadoop203 hadoop204 do
    echo "==============$i 上 ES 停止=============="
    ssh $i "ps -ef|grep $es_home |grep -v grep|awk '{print \$2}'|xargs
kill" >/dev/null 2>&1
  done
} ;;
esac
